<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
// 6. 将用户输入的网址全部转化成我们的官网。如www.baidu.com=>www.lagou.com
        var a = prompt("请输入网址")
        var re = /^(w{3}.)\w+(.com)$/
        var newstr = a.replace(re,function(match,$1,$2) {
            return $1 + "lagou" + $2;
        })
        console.log(newstr)
    </script>
</body>
</html>